package com.best.onegous.Adapter;

import java.util.ArrayList;
import java.util.List;

import com.best.onegous.R;
import com.best.onegous.details.User;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class PopularAdapter extends BaseAdapter {

	private List<String> list = new ArrayList<String>();
	private LayoutInflater layoutInflater;  
    private Context context;  
    public PopularAdapter(Context context,List<String> historyList) {
        this.list = historyList;
        this.context = context;  
        this.layoutInflater = LayoutInflater.from(context);  
    }
    @Override
	public int getCount() {
		return list.size();
	}
	@Override
	public Object getItem(int arg0) {
		return list.get(arg0);
	}
	@Override
	public long getItemId(int arg0) {
		return arg0;
	}
  
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    	ViewHolder viewhome=null;
		if(convertView==null){
			viewhome = new ViewHolder();
			convertView = layoutInflater.inflate(R.layout.fenlei_item, null);
			viewhome.title = (TextView)convertView.findViewById(R.id.history_name);
			//viewhome.item = (LinearLayout) convertView.findViewById(R.id.item);
			//viewhome.title = (TextView) convertView.findViewById(R.id.title);
			convertView.setTag(viewhome);
		}else{
			viewhome = (ViewHolder) convertView.getTag();
		}
		viewhome.title.setText(list.get(position));
			Animation anim= AnimationUtils.loadAnimation(context, R.anim.my_scale_fade_action);
			anim.setDuration(300);
			anim.setFillAfter(true);
			anim.setRepeatCount(0);
			convertView.startAnimation(anim);
		
		return convertView;
       /* ViewHolder holder;
        if (convertView == null) {
        	holder = new ViewHolder();
        	convertView = layoutInflater.inflate(R.layout.fenlei_item, null);
    		holder.title = (TextView)convertView.findViewById(R.id.history_name);
    		convertView.setTag(holder);
        }
        else{
            holder=(ViewHolder)convertView.getTag();
        }
        
        holder.title.setText(list.get(position));
				Animation anim= AnimationUtils.loadAnimation(context, R.anim.my_scale_fade_action);
				anim.setDuration(300);
				anim.setFillAfter(true);
				anim.setRepeatCount(0);
				convertView.startAnimation(anim);
		
        return convertView;*/
    }
    public class ViewHolder{
    	public TextView title;
    }
}